home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / dev / misc / Progr_Langs_v6.lha / Progr_Langs / cpp_verification / e.cpp next >
Encoding:
C/C++ Source or Header  |  1999-01-19  |  266 b   |  21 lines

  1. #include <iostream.h>
  2.  
  3. // Exceptions verification
  4.  
  5. void main()
  6. {
  7.   float a = 3;
  8.   float b = 0;
  9.   float c;
  10.   try
  11.   {
  12.     if(b == 0) throw "division by zero\n";
  13.     c = a / b;
  14.     cout << c << endl;
  15.   }
  16.   catch(...)
  17.   {
  18.     cout << "Exception ocurred." << endl;
  19.   }
  20. }
  21.